package com.jt.rabbitmq.work;

import com.jt.utils.ConnectionUtil;
import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer1 {
    private static final String QUEUE_NAME = "work-liushuhong1";

    public static void main(String[] args) throws IOException, TimeoutException {
        ConnectionUtil ConnectionUtil = new ConnectionUtil();
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare(QUEUE_NAME, true, false, false, null);
        for (int i = 0; i <10 ; i++) {
            String body=i+"Consumer1";
            System.out.println(body);
            channel.basicPublish("",QUEUE_NAME,null,body.getBytes());
        }
        channel.close();
        connection.close();
    }
}
